package com.yuantong.xyerp.core.provider.service;

import com.yuantong.xyerp.core.api.model.Attachment;
import com.yuantong.xyerp.core.api.service.IAttachmentService;
import com.yuantong.xyerp.core.provider.dao.AttatchmentMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 金鑫
 * @date 2019/9/5 0005
 */
@Slf4j
@Service
public class AttachmentServiceImpl implements IAttachmentService {

    @Resource
    private AttatchmentMapper attatchmentMapper;

    @Override
    public Attachment getById(String id) {
        return attatchmentMapper.getById(id);
    }

    @Override
    public void saveAttachment(Attachment attachment) {
        attatchmentMapper.insert(attachment);
    }

    @Override
    public List<Attachment> getByMasterId(String masterId) {
        return attatchmentMapper.findByMasterId(masterId);
    }
    @Override
    public void deleteAttachment(String attachmentId){
        attatchmentMapper.deleteById(attachmentId);
    }


}
